import request from '../util/api'

/**
 * @param {{ id: any; }} pram
 */
export function getFormTempInfo(pram) {
  const data = {
    id: pram.id
  }
  return request({
    url: '/inbox/form/temp/info',
    method: 'GET',
    params: data
  })
}

/**
 * @param {{ keywords: any; userId: any; page: any; limit: any; }} pram
 */
export function getFormTempList(pram) {
  const data = {
    keywords: pram.keywords,
    userId: pram.userId,
    page: pram.page,
    limit: pram.limit
  }
  return request({
    url: '/inbox/form/temp/list',
    method: 'GET',
    params: data
  })
}

/**
 * @param {{ content: any; info: any; name: any; userId: any; }} pram
 */
export function getFormTempSave(pram) {
  const data = {
    content: pram.content,
    info: pram.info,
    name: pram.name,
    userId: pram.userId
  }
  return request({
    url: '/inbox/form/temp/save',
    method: 'POST',
    data: data
  })
}

/**
 * @param {{ id: any; content: any; info: any; name: any; userId: any; }} pram
 */
export function getFormTempEdit(pram) {
  const params = { id: pram.id }
  const data = {
    content: pram.content,
    info: pram.info,
    name: pram.name,
    userId: pram.userId
  }
  return request({
    url: '/inbox/form/temp/update',
    method: 'POST',
    params: params,
    data: data
  })
}

/**
 * 通过名称查询详情
 * @param pram
 * @param {{ id: any; userId: any; }} param
 */
export function deleteFormTempApi(param) {
  return request({
    url: `/inbox/form/temp/${param.id}`,
    method: 'delete',
    params: {
      userId: param.userId
    }
  })
}


/**
 * 切换表单状态
 * @param {{ id: any; status: any; userId: any; }} pram
 */
export function switchFormTempStatus(pram) {
  const data = {
    formId: pram.id,
    status: pram.status,
    userId: pram.userId
  }
  return request({
    url: '/inbox/form/temp/switch',
    method: 'PUT',
    data: data
  })
}

/**
 * @param {{ formId: any; }} pram
 */
export function getSubmitUserList(pram) {
  const data = {
    formId: pram.formId
  }
  return request({
    url: '/inbox/form/temp/getSubmitUserList',
    method: 'GET',
    params: data
  })
}
